package sqlserver;

import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.sql.Connection;

import org.firefly.db.util.DBInfo;
import org.firefly.db.util.DBName;
import org.firefly.db.util.DBUtils;

public class Eadpv4 {

	/**
	 * @param args
	 * @throws Exception 
	 */
	public static void main(String[] args) throws Exception {
		Class.forName("net.sourceforge.jtds.jdbc.Driver");
		Connection srcConn = java.sql.DriverManager.getConnection("jdbc:jtds:sqlserver://172.16.1.12:1433/eadpv4pro", "sa", "eplugger6669@");
		Connection tarConn = java.sql.DriverManager.getConnection("jdbc:jtds:sqlserver://192.168.120.158:1433/eadpv4pro", "sa", "eplugger");
		try {
			DBInfo srcInfo = new DBInfo(srcConn, null, DBName.SqlServer2005);
			DBInfo tarInfo = new DBInfo(tarConn, null, DBName.SqlServer2005);
			DBUtils.dbConvertA2B(srcInfo, tarInfo, true);
//			FileOutputStream fos = new FileOutputStream("/Users/firefly/Desktop/a.sql");
//			OutputStreamWriter osw = new OutputStreamWriter(fos);
//			DBUtils.expertInsertSQL(srcInfo, srcInfo.getDialect(), osw, new String[]{"SYS_MENU"}, null, true);
//			File sqlFile = new File("/Users/firefly/Desktop/eadp5_1.sql");
//			DBUtils.dbConvertA2SqlFile(srcInfo, sqlFile);
		} finally{
			srcConn.close();
			tarConn.close();
		}
	}

}
